package cn.com.lightech.led_g5g.wedgit;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;

import cn.com.lightech.led_g5g.R;

/**
 * 简单对话框
 * Created by hardy.zhou on 2016/3/12.
 */
public class LedChannelNoDialog extends Dialog {

    private Button mBtnThree, mBtnFive;



    private OnButtonClickListener onButtonClickListener;

    public LedChannelNoDialog(Context context) {
        this(context, R.style.dialog);
    }

    public LedChannelNoDialog(Context context, int theme) {
        super(context, theme);
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_change_channel);
        initView();
        setCanceledOnTouchOutside(false);
    }

    /**
     * 初始化组件
     */
    private void initView() {
        mBtnThree = (Button) findViewById(R.id.btn_channel_three);
        mBtnFive = (Button) findViewById(R.id.btn_channel_five);
        initViewListener();
    }

    /**
     * 初始化组件监听器
     */
    private void initViewListener() {

        mBtnThree.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (null != onButtonClickListener) {
                    onButtonClickListener.onThreeButtonClick();
                }
            }
        });
        mBtnFive.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                dismiss();
                if (null != onButtonClickListener) {
                    onButtonClickListener.onFiveButtonClick();
                }
            }
        });
    }

    /**
     * 设置回调接口
     *
     * @param onButtonClickListener
     */
    public void setOnButtonClickListener(OnButtonClickListener onButtonClickListener) {
        this.onButtonClickListener = onButtonClickListener;
    }

    /**
     * 回调接口
     */
    public interface OnButtonClickListener {

        void onFiveButtonClick();

        void onThreeButtonClick();
    }
}